/**
 * @ClassName LC171
 * @Author ykx
 * @Date 2024/3/29 16:46
 * @Version 1.0
 */
public class LC171 {
    public static void main(String[] args) {
        LC171 lc171 = new LC171();
        System.out.println(lc171.titleToNumber("ZY"));
    }

    public int titleToNumber(String columnTitle) {
        int result = 0;
        for (int i = 0; i < columnTitle.length(); i++) {
            result = result * 26;
            result += columnTitle.charAt(i) - 'A' + 1;
        }
        return result;
    }
}
